package com.ulic.customerManApplication.membermodule.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ulic.customerManApplication.membermodule.bo.SubMember;
import com.ulic.customerManApplication.membermodule.service.MemberExtService;

@Component("memberExtAction")
@Scope("prototype")
public class MemberExtAction extends MemberAction {
	private static final long serialVersionUID = 1L;


	private List<SubMember> journeyLoveSubMembers;
	private List<SubMember> memberEnjoySubMembers;

	private MemberExtService memberExtService;

	public String viewMember() throws Exception {
		setMember(getMemberService().getMember(getMember().getId()));
		if (getMember() != null) {
			List<SubMember> memberSubMembers = memberExtService.getSubMembersByMember(getMember().getId());
			this.journeyLoveSubMembers = new ArrayList<SubMember>();
			this.memberEnjoySubMembers = new ArrayList<SubMember>();
			if (memberSubMembers != null) {
				for (SubMember subMember : memberSubMembers) {
					if (subMember.getSub_journeyOfLoveActivity() != null) {
						this.journeyLoveSubMembers.add(subMember);
					} else if (subMember.getSub_memberEnjoyActivity() != null) {
						this.memberEnjoySubMembers.add(subMember);
					}
				}
			}
		}
		return SUCCESS;
	}



	public MemberExtService getMemberExtService() {
		return memberExtService;
	}

	@Resource
	public void setMemberExtService(MemberExtService memberExtService) {
		this.memberExtService = memberExtService;
	}



	public List<SubMember> getJourneyLoveSubMembers() {
		return journeyLoveSubMembers;
	}



	public void setJourneyLoveSubMembers(List<SubMember> journeyLoveSubMembers) {
		this.journeyLoveSubMembers = journeyLoveSubMembers;
	}



	public List<SubMember> getMemberEnjoySubMembers() {
		return memberEnjoySubMembers;
	}



	public void setMemberEnjoySubMembers(List<SubMember> memberEnjoySubMembers) {
		this.memberEnjoySubMembers = memberEnjoySubMembers;
	}




}
